<?php if (!defined('DB_PEREFIX')) exit;


if ($_GET['mod'] == "clear_sessions") @mysql_query ("DELETE FROM ".DB_PEREFIX."_sessions");

$content_panel = "<div class=\"admin_block\"><a href='/admin/?name=articles'><img border='0' src='/images/admin/articles.jpg'><br>
Статьи</a></div>
<div class=\"admin_block\"><a href='?name=users'><img border='0' src='/images/admin/users.jpg'><br>
Пользователи</a></div>
<div class=\"admin_block\"><a href='?do=start_page'><img border='0' src='/images/admin/homepage.jpg'><br>
Стартовая страница</a></div>";

$system_panel = "<div class=\"admin_block\"><a href='/admin/?do=settings'><img border='0' src='/images/admin/settings.jpg'><br>
Настройки сайта</a></div>
<div class=\"admin_block\"><a href='?do=modules'><img border='0' src='/images/admin/modules.jpg'><br>
Модули</a></div>
<div class=\"admin_block\"><a href='?do=blocks'><img border='0' src='/images/admin/blocks.jpg'><br>
Блоки</a></div>
<div class=\"admin_block\"><a href='?do=menu'><img border='0' src='/images/admin/menu.jpg'><br>
Меню</a></div>
<div class=\"admin_block\"><a href='?do=panels'><img border='0' src='/images/admin/panels.jpg'><br>
Панели</a></div>
<div class=\"admin_block\"><a href='?do=plugins'><img border='0' src='/images/admin/plugins.jpg'><br>
Плагины</a></div>
<div class=\"admin_block\"><a href='?do=feedback'><img border='0' src='/images/admin/feedback.jpg'><br>
Форма обратной связи</a></div>
<!-- <div class=\"admin_block\"><a href='?do=statistics'><img border='0' src='/images/admin/statistics.gif'><br>
Статистика</a></div> -->
<div class=\"admin_block\"><a href='?do=show_errorlog'><img border='0' src='/images/admin/error.jpg'><br>
Журнал ошибок</a></div>";

$utilits_panel = "<div class=\"admin_block\"><a href='?do=black_list'><img border='0' src='/images/admin/ipban.jpg'><br>
Черный список</a></div>
<div class=\"admin_block\"><a href='?do=mailer'><img border='0' src='/images/admin/mail.jpg'><br>
Рассылка</a></div>
<div class=\"admin_block\"><a href='?do=mysql'><img border='0' src='/images/admin/db.jpg'><br>
Запрос к БД</a></div>
<div class=\"admin_block\"><a href='?do=update'><img border='0' src='/images/admin/update.jpg'><br>
Обновление</a></div>
<!-- <div class=\"admin_block\"><a href='?do=help'><img border='0' src='/images/admin/faq.gif'><br>
Справка</a></div> -->
<div class=\"admin_block\"><a href='?do=logs'><img border='0' src='/images/admin/logs.jpg'><br>
Логи системы</a></div>";
/*
function gdversion(){
    static $gd_version_number = null;
    if ($gd_version_number === null) {
        ob_start();
        phpinfo(8);
        $module_info = ob_get_contents();
        ob_end_clean();
        if (preg_match("/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i",
                $module_info, $matches)) {
            $gdversion_h = $matches[1];
        } else {
            $gdversion_h = 0;
        } 
    } 
    return $gdversion_h;
} */

$information = "<table width=100% class=main_text border=0 cellspacing=0 cellpadding=2>
<tr><td width=30%></td><td></td></tr>
<tr><td>Web-сервер:</td><td>".$_SERVER['SERVER_SOFTWARE']."</td></tr>
<tr><td>Подпись сервера:</td><td>".$_SERVER['SERVER_SIGNATURE']."</td></tr>
<tr><td>Каталог на сервере:</td><td>".$_SERVER['DOCUMENT_ROOT']."</td></tr>
<tr><td>Версия PHP:</td><td>".phpversion()."</td></tr><tr>
<td>Версия MySQL:</td><td>".mysql_get_server_info()."</td></tr>
<tr><td>Версия GD:</td><td>-</td></tr>
</table>";

$_SERVER['SERVER_SOFTWARE'];

$get_online = @mysql_query ("SELECT * FROM ".DB_PEREFIX."_sessions");
$total = @mysql_num_rows ($get_online);
$user_line = "";
$guest_ip = "";
$u = 0;
$g = 0;
while ($user = mysql_fetch_array ($get_online)) {
	if ($user['uid'] != "" && $u <= 40) {
		$select_user = @mysql_query ("SELECT user_name FROM ".DB_PEREFIX."_users WHERE user_id = '".$user['uid']."'");
		if (@mysql_num_rows($select_user) > 0) {
			$user_ = mysql_fetch_array ($select_user);
			$user_line .= "\n<tr><td width=37%>— <a href=\"/admin/?name=users&id=".$user['uid']."\">".$user_['user_name']."</a> (<a href='http://www.nic.ru/whois/?ip=".$user_['uip']."' target=_blank>".$user['uip']."</a>)</td><td>".$user['page']."</td></tr>";
			$u++;
		}
	}
	if ($user['ugroup'] == "guest" && $g <= 100) {
		$guest_ip .= "\n[ <a href='http://www.nic.ru/whois/?ip=".$user['uip']."' target=_blank>".$user['uip']."</a> - ".$user['page']." ] ";
		$g++;
	}
}
$get_guest_online = @mysql_num_rows (mysql_query ("SELECT * FROM ".DB_PEREFIX."_sessions WHERE ugroup = 'guest'"));
$get_users_online = @mysql_num_rows (mysql_query ("SELECT * FROM ".DB_PEREFIX."_sessions WHERE ugroup = 'user'"));

$users_on_line = "<table width=100% class=main_text border=0 cellspacing=0 cellpaddin=2>
<tr><td colspan=2>Всего пользователей on-line: $total (пользователи: $get_users_online, гости: $get_guest_online)<p /><strong>Пользователи:</strong></td></tr>
$user_line
<tr><td colspan=2><br><strong>Гости:</strong><br>$guest_ip</td></tr>
</table>";

past_table ("Контент", $content_panel);
past_table ("Система", $system_panel);
past_table ("Утилиты", $utilits_panel);

past_table ("Системная информация", $information);

?>
